package serviceImpl;

import java.io.File;
import java.util.List;

public class FileUtils {

		public static int searchFiles(String targetFileName,File searchBaseDir,List<File> files){
			File[] fs = searchBaseDir.listFiles();
			int count = 0;
			if(fs != null){
				for(int i = 0; i < fs.length; i++){
					File f = fs[i];
					if(f.getName().toLowerCase().equals(".svn")){
						continue;
					}
					if(f.isFile()){
						if(f.getName().equals(targetFileName)){
							files.add(f);
							count++;
						}
					}else if(f.isDirectory()){
						count = count + searchFiles(targetFileName, f, files);
					}
				}
			}
			return count;
		}
	}

